﻿namespace ProblemsSet
{
    public class Problem_20 : BaseProblem
    {
        public override object GetResult()
        {
            long summ = 0;
            GetFactorial(100, out summ);
            return summ;

        }

        public override string Problem
        {
            get
            {
                return @"n! means n x (n  1) x ... x 3 x 2 x 1

Find the sum of the digits in the number 100!";
            }
        }

        public static string GetFactorial(long value, out long summDigits)
        {
            var res = "2";
            summDigits = 2;
            for (var i = 3; i <= value; i++)
            {
                res = MathLogic.MultipleString(res, i, out summDigits);
            }
            return res;
        }

        public override bool IsSolved
        {
            get
            {
                return true;
            }
        }

        public override object Answer
        {
            get
            {
                return 648;
            }
        }

    }
}
